//分类View

import React, {Component} from 'react';
import {
    View,
    StyleSheet,
    Image,
    Text,
    TouchableOpacity,
    ScrollView,
    Animated,
    PanResponder,
    Easing,
    Alert
} from 'react-native';
import { inject, observer } from 'mobx-react';

@inject("categoryGoods")
@observer
export default class Category extends Component {
    constructor(props){
        super(props);

        this.store = this.props.categoryGoods;
    }
    render(){
        const Goods = this.store.Goods;
        return(
            <View>
                <ScrollView
                    keyboardShouldPersistTaps='always' 
                    keyboardDismissMode='interactive'>
                {
                    Goods.map((item,index) =>{
                        return (
                            <TouchableOpacity key={index} onPress={() =>{
                                const {navigate} = this.props.navigation; 
                                navigate('ItemDetail',{goods:item});
                            }}>
                                <View>
                                    <Text>{item.name}</Text>
                                    <Text>{item.price}</Text>
                                </View>
                            </TouchableOpacity>
                        )
                    })
                }
                </ScrollView>
            </View>
        )
    }
}